<template>
  <!-- 机构成员 -->
  <div class="organizationmember">
    <!-- 条件 -->
    <el-card id="top_card" :shadow="shadowShow" class="top_nav">
      <div class="top_nav_inner">
        <div class="top_nav_left">
          <el-form :inline="true" :size="optionButtonSize" label-width="0px">
            <el-form-item>
              <el-input
                v-model="form.name"
                :placeholder="$t('members.chengyuan1')"
                clearable
                style="width: 360px"
                @keyup.enter.native="getMemberList"
              >
                <!-- <i slot="suffix" class="el-input__icon el-icon-search" style="color:#003E67;"></i> -->
              </el-input>
            </el-form-item>
            <!-- <el-form-item>
                <el-input placeholder="请输入加工厂名称" style="width:200px">
                </el-input>
            </el-form-item> -->
            <el-form-item>
              <el-button :size="optionButtonSize" type="primary" @click="getMemberList"
                >{{ $t('members.chengyuan2') }}
              </el-button>
              <el-button :size="optionButtonSize" plain @click="resetClick"
                >{{ $t('members.chengyuan3') }}
              </el-button>
            </el-form-item>
          </el-form>
        </div>
        <div
          v-if="user_roleId == 1 || user_roleId == 2 || user_roleId == 4 || user_owner == 1"
          class="top_nav_right"
        >
          <el-button :size="optionButtonSize" icon="el-icon-plus" type="primary" @click="memberAdd">
            {{ $t('members.chengyuan4') }}
          </el-button>
        </div>
      </div>
    </el-card>
    <el-card id="content_card" :shadow="shadowShow" class="partner_inner">
      <el-table
        :data="tableData"
        :header-cell-style="headercellstyle"
        size="mini"
        style="width: 100%"
      >
        <!-- <el-table-column align="center" prop="deptName" :label="$t('members.chengyuan5')">
        </el-table-column> -->
        <el-table-column :label="$t('members.chengyuan6')" align="center" prop="realName" />
        <el-table-column :label="$t('members.chengyuan7')" align="center" prop="mobile" />
        <el-table-column :label="$t('members.chengyuan8')" align="center" prop="email" />
        <el-table-column :label="$t('members.chengyuan9')" align="center" prop="roleName">
          <template slot-scope="scope">
            {{
              scope.row.owner == 1
                ? $t('members.chengyuan10')
                : scope.row.roleName === '普通成员'
                ? $t('members.chengyuan57')
                : $t('members.chengyuan58')
            }}
          </template>
        </el-table-column>
        <el-table-column :label="$t('members.chengyuan11')" align="center" prop="joinDate" />
        <el-table-column :label="$t('members.chengyuan12')" align="center" prop="checkStatus">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.checkStatus == 0" :size="tableTagSize" type="info">
              {{ $t('add.add019') }}
            </el-tag>
            <el-tag v-if="scope.row.checkStatus == 1" :size="tableTagSize" type="success"
              >{{ $t('members.chengyuan14') }}
            </el-tag>
            <el-tag v-if="scope.row.checkStatus == 2" :size="tableTagSize" type="warning"
              >{{ $t('members.chengyuan15') }}
            </el-tag>
            <el-tag v-if="scope.row.checkStatus == 3" :size="tableTagSize" type="danger"
              >{{ $t('members.chengyuan16') }}
            </el-tag>
            <el-tag v-if="scope.row.checkStatus == 4" :size="tableTagSize" type="danger">
              {{ $t('add.add018') }}
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column
          :label="$t('members.chengyuan17')"
          align="center"
          min-width="150"
          prop="date4"
        >
          <template slot-scope="scope" style="display: flex; justify-content: flex-start">
            <!-- 0 内部待确认,1: 审核通过 ,2,审核拒绝 3已退出 4外部待审核  -->
            <!-- 0内部待确认叫待确认 4外部待确认叫待审核 -->
            <!-- 诊所 -->
            <div v-if="user_organizedType == 1">
              <!-- 诊所  登录者为 机构所有者 -->
              <div v-if="user_owner == 1">
                <!-- 所有者下成员角色 所有者 -->
                <div v-if="scope.row.owner == 1">
                  <!-- 所有者 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="
                        $router.push(
                          `/caseorder?id=${scope.row.userId}&caseMembers=${scope.row.userId}`,
                        )
                      "
                      >{{ $t('members.chengyuan18') }}
                    </el-button>
                  </div>
                </div>
                <!-- 所有者下成员角色 普通成员 -->
                <div v-if="scope.row.owner != 1 && scope.row.roleId == 3">
                  <!-- 普通成员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="
                        $router.push(
                          `/caseorder?id=${scope.row.userId}&caseMembers=${scope.row.userId}`,
                        )
                      "
                      >{{ $t('members.chengyuan18') }}
                    </el-button>
                    <el-popover :ref="scope.row.id" placement="bottom" width="380">
                      <Power
                        :ref="`power${scope.row.id}`"
                        :permissionList="permissionList"
                        @getPowerData="getPowerData"
                      />
                      <div style="text-align: right; margin: 0">
                        <el-button size="mini" type="text" @click="powerCance(powerRow.id)">{{
                          $t('add.add31')
                        }}</el-button>
                        <el-button type="primary" size="mini" @click="powerSubmit(powerRow)">{{
                          $t('add.add30')
                        }}</el-button>
                      </div>
                      <el-button
                        slot="reference"
                        :size="tableButtonSize"
                        type="text"
                        @click="surePowerRow(scope.row, '1')"
                        >{{ $t('members.chengyuan19') }}
                      </el-button>
                    </el-popover>

                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 外部人员申请加入 待确认 -->
                  <div v-if="scope.row.checkStatus == 4">
                    <el-dropdown @command="approveMember">
                      <el-button :size="tableButtonSize" type="text"
                        >{{ $t('members.chengyuan24') }}
                      </el-button>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'ty', scope.row.realName)"
                          >{{ $t('members.chengyuan25') }}
                        </el-dropdown-item>
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'jj', scope.row.realName)"
                          >{{ $t('members.chengyuan26') }}
                        </el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </div>
                  <!-- 普通成员 外部人员申请加入 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2">
                    <!-- 拒绝原因 -->
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 待确认 -->
                  <div v-if="scope.row.checkStatus == 0">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2 && 1 == 2">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                </div>
                <!-- 所有者下成员角色 管理员 -->
                <div v-if="scope.row.owner != 1 && scope.row.roleId == 2">
                  <!-- 管理员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="
                        $router.push(
                          `/caseorder?id=${scope.row.userId}&caseMembers=${scope.row.userId}`,
                        )
                      "
                      >{{ $t('members.chengyuan18') }}
                    </el-button>

                    <el-popover :ref="scope.row.id" placement="bottom" width="380">
                      <Power
                        :ref="`power${scope.row.id}`"
                        :permissionList="permissionList"
                        @getPowerData="getPowerData"
                      />
                      <div style="text-align: right; margin: 0">
                        <el-button size="mini" type="text" @click="powerCance(powerRow.id)">{{
                          $t('add.add31')
                        }}</el-button>
                        <el-button type="primary" size="mini" @click="powerSubmit(powerRow)">{{
                          $t('add.add30')
                        }}</el-button>
                      </div>
                      <el-button
                        slot="reference"
                        :size="tableButtonSize"
                        type="text"
                        @click="surePowerRow(scope.row, '1')"
                        >{{ $t('members.chengyuan19') }}
                      </el-button>
                    </el-popover>

                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 管理员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 管理员 内部机构添加的成员 待确认 -->
                  <div v-if="scope.row.checkStatus == 0">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 管理员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2">
                    <!-- 拒绝原因 -->
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                  <!-- 管理员 待审核 -->
                  <div v-if="scope.row.checkStatus == 4">
                    <el-dropdown @command="approveMember">
                      <el-button :size="tableButtonSize" type="text"
                        >{{ $t('members.chengyuan24') }}
                      </el-button>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'ty', scope.row.realName)"
                          >{{ $t('members.chengyuan25') }}
                        </el-dropdown-item>
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'jj', scope.row.realName)"
                          >{{ $t('members.chengyuan26') }}
                        </el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </div>
                </div>
              </div>
              <!-- 诊所  登录者为 机构管理员 -->
              <div v-else-if="user_owner == 0 && user_roleId == 2">
                <!-- 管理员下成员角色 所有者 -->
                <div v-if="scope.row.owner == 1">
                  <!-- 所有者 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="
                        $router.push(
                          `/caseorder?id=${scope.row.userId}&caseMembers=${scope.row.userId}`,
                        )
                      "
                      >{{ $t('members.chengyuan18') }}
                    </el-button>
                  </div>
                </div>
                <!-- 管理员下成员角色 管理员 -->
                <div v-if="scope.row.owner != 1 && scope.row.roleId == 2">
                  <!-- 管理员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="
                        $router.push(
                          `/caseorder?id=${scope.row.userId}&caseMembers=${scope.row.userId}`,
                        )
                      "
                      >{{ $t('members.chengyuan18') }}
                    </el-button>
                  </div>
                  <!-- 管理员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 管理员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2 && 1 == 2">
                    <!-- 拒绝原因 -->
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                </div>
                <!-- 管理员下成员角色 普通成员 -->
                <div v-if="scope.row.owner != 1 && scope.row.roleId == 3">
                  <!-- 普通成员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="
                        $router.push(
                          `/caseorder?id=${scope.row.userId}&caseMembers=${scope.row.userId}`,
                        )
                      "
                      >{{ $t('members.chengyuan18') }}
                    </el-button>
                    <el-popover :ref="scope.row.id" placement="bottom" width="380">
                      <Power
                        :ref="`power${scope.row.id}`"
                        :permissionList="permissionList"
                        @getPowerData="getPowerData"
                      />
                      <div style="text-align: right; margin: 0">
                        <el-button size="mini" type="text" @click="powerCance(powerRow.id)">{{
                          $t('add.add31')
                        }}</el-button>
                        <el-button type="primary" size="mini" @click="powerSubmit(powerRow)">{{
                          $t('add.add30')
                        }}</el-button>
                      </div>
                      <el-button
                        slot="reference"
                        :size="tableButtonSize"
                        type="text"
                        @click="surePowerRow(scope.row, '2')"
                        >{{ $t('members.chengyuan19') }}
                      </el-button>
                    </el-popover>

                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 外部人员申请加入 待确认 -->
                  <div v-if="scope.row.checkStatus == 4">
                    <el-dropdown style="margin-left: 8px" @command="approveMember">
                      <el-button :size="tableButtonSize" type="text"
                        >{{ $t('members.chengyuan24') }}
                      </el-button>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'ty', scope.row.realName)"
                          >{{ $t('members.chengyuan25') }}
                        </el-dropdown-item>
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'jj', scope.row.realName)"
                          >{{ $t('members.chengyuan26') }}
                        </el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </div>
                  <!-- 普通成员 外部人员申请加入 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2">
                    <!-- 拒绝原因 -->
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 待确认 -->
                  <div v-if="scope.row.checkStatus == 0">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2 && 1 == 2">
                    <!-- 拒绝原因 -->
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                </div>
              </div>
              <!-- 诊所  登录者为 机构普通成员 -->
              <div v-else-if="user_owner == 0 && user_roleId == 3">
                <!-- 诊所 已确认 -->
                <div v-if="scope.row.checkStatus == 1"></div>
              </div>
            </div>
            <!-- 技工所 所有者 -->
            <div v-if="user_organizedType == 2">
              <!-- 技工所  登录者为 机构所有者 -->
              <div v-if="user_owner == 1">
                <!-- 所有者下成员角色 所有者 -->
                <div v-if="scope.row.owner == 1">
                  <!-- 所有者 已确认 -->
                  <div v-if="scope.row.checkStatus == 1"></div>
                </div>
                <!-- 所有者下成员角色 普通成员 -->
                <div v-if="scope.row.owner == 0 && scope.row.roleId == 5">
                  <!-- 普通成员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-popover :ref="scope.row.id" placement="bottom" width="380">
                      <Power
                        :ref="`power${scope.row.id}`"
                        :row="powerRow"
                        @getPowerData="getPowerData"
                      />
                      <div style="text-align: right; margin: 0">
                        <el-button size="mini" type="text" @click="powerCance(powerRow.id)">{{
                          $t('add.add31')
                        }}</el-button>
                        <el-button type="primary" size="mini" @click="powerSubmit(powerRow)">{{
                          $t('add.add30')
                        }}</el-button>
                      </div>
                      <el-button
                        slot="reference"
                        :size="tableButtonSize"
                        type="text"
                        @click="surePowerRow(scope.row, '1')"
                        >{{ $t('members.chengyuan19') }}
                      </el-button>
                    </el-popover>

                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 外部人员申请加入 待确认 -->
                  <div v-if="scope.row.checkStatus == 4">
                    <el-dropdown style="margin-left: 8px" @command="approveMember">
                      <el-button :size="tableButtonSize" type="text"
                        >{{ $t('members.chengyuan24') }}
                      </el-button>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'ty', scope.row.realName)"
                          >{{ $t('members.chengyuan25') }}
                        </el-dropdown-item>
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'jj', scope.row.realName)"
                          >{{ $t('members.chengyuan26') }}
                        </el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </div>
                  <!-- 普通成员 外部人员申请加入 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 待确认 -->
                  <div v-if="scope.row.checkStatus == 0">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2 && 1 == 2">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                </div>
                <!-- 所有者下成员角色 管理员 -->
                <div v-if="scope.row.owner != 1 && scope.row.roleId == 4">
                  <!-- 管理员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-popover :ref="scope.row.id" placement="bottom" width="380">
                      <Power
                        :ref="`power${scope.row.id}`"
                        :permissionList="permissionList"
                        @getPowerData="getPowerData"
                      />
                      <div style="text-align: right; margin: 0">
                        <el-button size="mini" type="text" @click="powerCance(powerRow.id)">{{
                          $t('add.add31')
                        }}</el-button>
                        <el-button type="primary" size="mini" @click="powerSubmit(powerRow)">{{
                          $t('add.add30')
                        }}</el-button>
                      </div>
                      <el-button
                        slot="reference"
                        :size="tableButtonSize"
                        type="text"
                        @click="surePowerRow(scope.row, '1')"
                        >{{ $t('members.chengyuan19') }}
                      </el-button>
                    </el-popover>

                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 管理员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 管理员 内部机构添加的成员 待确认 -->
                  <div v-if="scope.row.checkStatus == 0">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 管理员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                  <!-- 审核管理员 -->
                  <div v-if="scope.row.checkStatus == 4">
                    <el-dropdown style="margin-left: 8px" @command="approveMember">
                      <el-button :size="tableButtonSize" type="text"
                        >{{ $t('members.chengyuan24') }}
                      </el-button>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'ty', scope.row.realName)"
                          >{{ $t('members.chengyuan25') }}
                        </el-dropdown-item>
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'jj', scope.row.realName)"
                          >{{ $t('members.chengyuan26') }}
                        </el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </div>
                </div>
              </div>
              <!-- 技工所  登录者为 机构管理员 -->
              <div v-else-if="user_owner == 0 && user_roleId == 4">
                <!-- {{ user_owner }} {{ user_roleId }} -->
                <!-- 管理员下成员角色 所有者 -->
                <div v-if="scope.row.owner == 1">
                  <!-- 所有者 已确认 -->
                  <div v-if="scope.row.checkStatus == 1"></div>
                </div>
                <!-- 管理员下成员角色 管理员 -->
                <div v-if="scope.row.owner != 1 && scope.row.roleId == 2">
                  <!-- 管理员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1"></div>
                  <!-- 管理员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 管理员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                </div>
                <!-- 管理员下成员角色 普通成员 -->
                <div v-if="scope.row.owner != 1 && scope.row.roleId == 5">
                  <!-- 普通成员 -->
                  <!-- 普通成员 已确认 -->
                  <div v-if="scope.row.checkStatus == 1">
                    <el-popover :ref="scope.row.id" placement="bottom" width="380">
                      <Power
                        :ref="`power${scope.row.id}`"
                        :permissionList="permissionList"
                        @getPowerData="getPowerData"
                      />
                      <div style="text-align: right; margin: 0">
                        <el-button size="mini" type="text" @click="powerCance(powerRow.id)">{{
                          $t('add.add31')
                        }}</el-button>
                        <el-button type="primary" size="mini" @click="powerSubmit(powerRow)">{{
                          $t('add.add30')
                        }}</el-button>
                      </div>
                      <el-button
                        slot="reference"
                        :size="tableButtonSize"
                        type="text"
                        @click="surePowerRow(scope.row, '2')"
                        >{{ $t('members.chengyuan19') }}
                      </el-button>
                    </el-popover>
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 已退出 -->
                  <div v-if="scope.row.checkStatus == 3">
                    <el-button :size="tableButtonSize" type="text" @click="tuichu(scope.row.remark)"
                      >{{ $t('members.chengyuan23') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 外部人员申请加入 待确认 -->
                  <div v-if="scope.row.checkStatus == 4">
                    <el-dropdown @command="approveMember">
                      <el-button :size="tableButtonSize" type="text"
                        >{{ $t('members.chengyuan24') }}
                      </el-button>
                      <el-dropdown-menu slot="dropdown">
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'ty', scope.row.realName)"
                          >{{ $t('members.chengyuan25') }}
                        </el-dropdown-item>
                        <el-dropdown-item
                          :command="beforeHandleCommand(scope.row.id, 'jj', scope.row.realName)"
                          >{{ $t('members.chengyuan26') }}
                        </el-dropdown-item>
                      </el-dropdown-menu>
                    </el-dropdown>
                  </div>
                  <!-- 普通成员 外部人员申请加入 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 待确认 -->
                  <div v-if="scope.row.checkStatus == 0">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="deleteItem(scope.row.id, scope.row.realName, scope.row.checkStatus)"
                      >{{ $t('members.chengyuan22') }}
                    </el-button>
                  </div>
                  <!-- 普通成员 内部机构添加的成员 已拒绝 -->
                  <div v-if="scope.row.checkStatus == 2 && 1 == 2">
                    <el-button
                      :size="tableButtonSize"
                      type="text"
                      @click="jujue(scope.row.rejectReason)"
                      >{{ $t('members.chengyuan27') }}
                    </el-button>
                  </div>
                </div>
              </div>
              <!-- 技工所  登录者为 机构普通成员 -->
              <div v-else-if="user_owner == 0 && user_roleId == 5">
                <!-- 诊所 已确认 -->
                <div v-if="scope.row.checkStatus == 1"></div>
              </div>
            </div>

            <!-- 转让所有者(当前登录账号并且当前行是所有者才会出现转让所有者按钮) -->
            <div>
              <el-button
                v-if="user_owner == 1 && scope.row.owner == 1"
                :size="tableButtonSize"
                type="text"
                @click="transferOwner(scope.row)"
                >{{ $t('members.chengyuan70') }}
              </el-button>
            </div>
          </template>
        </el-table-column>
      </el-table>
      <div style="margin: 16px 0; float: right">
        <el-pagination
          :current-page.sync="currentPage"
          :page-size="limit"
          :page-sizes="[20, 50, 100, 200]"
          :total="total"
          background
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
        />
      </div>
    </el-card>
    <MemberAdd ref="MemberAdd" @getMemberList="getMemberList" />
    <el-dialog
      :title="$t('add.add020')"
      :visible.sync="dialogShow"
      top="20vh"
      width="700px"
      :close-on-click-modal="false"
    >
      <div class="join">
        <div class="tip" style="margin-bottom: 30px">
          <span
            >{{ $t('members.chengyuan28') }}【{{ deleteForm.realName }}】{{
              $t('members.chengyuan29')
            }}</span
          >
        </div>
        <!-- <div style="margin-bottom:60px;">
            <el-form label-position="top" label-width="200px" ref="deleteForm" :model="deleteForm"
                :size="formItemSize">
                <el-form-item label="删除原因：" prop="">
                    <el-input :autosize="{ minRows: 5 }" type="textarea" v-model="deleteForm.remark"
                        placeholder="请输入删除原因" />
                </el-form-item>
            </el-form>
        </div> -->
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button :size="optionButtonSize" plain @click="delcancleHandle"
          >{{ $t('members.chengyuan30') }}
        </el-button>
        <el-button :size="optionButtonSize" type="primary" @click="delsubmitHandle"
          >{{ $t('members.chengyuan31') }}
        </el-button>
      </div>
    </el-dialog>
    <el-dialog
      :title="$t('members.chengyuan26')"
      :visible.sync="jjdialogShow"
      top="20vh"
      width="700px"
      :close-on-click-modal="false"
    >
      <div class="join">
        <div class="tip" style="margin-bottom: 30px">
          <span
            >{{ $t('members.chengyuan32') }}【{{ jjForm.name }}】{{
              $t('members.chengyuan33')
            }}</span
          >
        </div>
        <div style="margin-bottom: 60px">
          <el-form
            ref="jjForm"
            :model="jjForm"
            :size="formItemSize"
            label-position="top"
            label-width="200px"
            :rules="refuseRules"
          >
            <el-form-item :label="$t('members.chengyuan27') + '：'" prop="rejectReason">
              <el-input
                v-model="jjForm.rejectReason"
                :autosize="{ minRows: 5 }"
                :placeholder="$t('members.chengyuan34')"
                type="textarea"
                maxlength="200"
                show-word-limit
              />
            </el-form-item>
          </el-form>
        </div>
      </div>
      <div slot="footer" class="dialog-footer">
        <el-button :size="optionButtonSize" plain @click="jjcancleHandle"
          >{{ $t('members.chengyuan30') }}
        </el-button>
        <el-button :size="optionButtonSize" type="primary" @click="jjsubmitHandle"
          >{{ $t('members.chengyuan31') }}
        </el-button>
      </div>
    </el-dialog>

    <el-dialog
      :title="$t('members.chengyuan70')"
      :visible.sync="transferOwnerShow"
      top="20vh"
      width="700px"
      :close-on-click-modal="false"
    >
      <div class="transfer_box">
        <div class="transferStep_box">
          <el-steps class="transferStep" :active="currStep" align-center>
            <el-step v-for="(item, index) in transferStep" :key="index" :title="item.title" />
          </el-steps>
        </div>
        <div class="transfer_content_box">
          <sendCode ref="sendCodeEl" v-show="currStep === 1"></sendCode>

          <el-select
            v-show="currStep === 2"
            v-model="transferor"
            :placeholder="$t('members.chengyuan74')"
            style="width: 100%"
            popper-class="transferorSelect"
          >
            <!-- 使用 slot="current" 来自定义回显 -->

            <el-option
              v-for="item in transferorList"
              :key="item.id"
              :label="item.value"
              :value="item.id"
            >
              <template #default="{ item: option }">
                <div>
                  <p style="height: 14px; font-size: 16px">{{ item.realName }}</p>
                  <p style="font-size: 14px">{{ item.email }}</p>
                </div>
              </template>
            </el-option>
          </el-select>
        </div>
      </div>
      <div slot="footer" class="dialog-footer" style="text-align: center">
        <el-button :size="optionButtonSize" plain @click="transfercancleHandle"
          >{{ $t('members.chengyuan30') }}
        </el-button>
        <el-button
          v-show="currStep === 1"
          :size="optionButtonSize"
          type="primary"
          @click="transfersubmitHandle('next')"
          >{{ $t('members.chengyuan73') }}
        </el-button>
        <el-button
          v-show="currStep === 2"
          :size="optionButtonSize"
          type="primary"
          @click="transfersubmitHandle('submit')"
          >{{ $t('members.chengyuan31') }}
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import Cookies from 'js-cookie';
import MemberAdd from './memberadd.vue';
import Power from './common/power.vue';
import sendCode from '@/components/sendCode/index';
export default {
  // <!-- 机构成员 -->
  name: 'BLZMasterIndex11',
  components: {
    MemberAdd,
    Power,
    sendCode,
  },
  data() {
    return {
      tableData: [],
      form: {
        name: '',
        deptName: '', // 所属机构
        realName: '', // 名称
        mobile: '', // 手机
        createDate: '',
      },
      jjForm: {
        deptId: null,
        name: '',
        rejectReason: '',
      },

      currentPage: 1, // 默认第1页
      total: 0, // 总条数
      limit: 20, // 每页条数
      user_roleId: '', // 权限id
      user_owner: '',
      user_organizedType: '', // 1诊所 2技工所
      deleteForm: {
        id: '',
        realName: '',
        remark: '',
      },
      dialogShow: false,
      jjdialogShow: false,

      powerRow: {},
      permissionList: [],

      user_type: null,
      changeRoleId: '',
      caminho: '',
      // 控制转让所有者弹框是否显示
      transferOwnerShow: false,
      // 转让步骤条数据
      transferStep: [
        {
          title: this.$t('members.chengyuan71'),
        },
        {
          title: this.$t('members.chengyuan72'),
        },
      ],
      // 当前点击的转让数据
      transferRow: {},
      // 当前选中的转让步骤
      currStep: 1,

      // 存储要转让的信息
      transferor: '',
      transferorList: [],

      refuseRules: {
        rejectReason: [
          {
            required: true,
            message: this.$t('members.chengyuan78'),
            trigger: 'blur',
          },
        ],
      },
    };
  },

  created() {
    this.getLoginCaminho();
    this.getMemberList();
  },
  mounted() {
    this.user_roleId = localStorage.getItem('user_roleId');
    this.user_owner = localStorage.getItem('user_owner');
    this.user_organizedType = localStorage.getItem('user_organizedType');
    this.$clacTableHeight();

    if (this.user_owner == 1) {
      // 所有者
      this.user_type = 1;
    } else if (
      (this.user_owner != 1 && this.user_roleId == 1) ||
      (this.user_owner != 1 && this.user_roleId == 2) ||
      (this.ser_owner != 1 && this.user_roleId == 4)
    ) {
      // 管理员
      this.user_type = 0;
    } else if (
      (this.user_owner != 1 && this.user_roleId == 3) ||
      (this.user_owner != 1 && this.user_roleId == 5)
    ) {
      // 普通成员
    }
  },
  methods: {
    getLoginCaminho() {
      this.$http
        .get(`/sys/dict/data/verifyLoginMethod`)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          } else {
            this.caminho = res.data;
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
    // 重置
    resetClick() {
      this.form = {
        name: '',
        deptName: '', // 所属机构
        realName: '', // 名称
        mobile: '', // 手机
        createDate: '',
      };
      this.currentPage = 1; // 默认第1页
      this.total = 0; // 总条数
      this.limit = 20; // 每页条数
      this.getMemberList();
    },
    // 拿表单数据
    getMemberList() {
      this.$http
        .get(
          `/sys/organized/getMemberList?page=${this.currentPage}&limit=${this.limit}&name=${this.form.name}&timeZone=${this.$timeZone}`,
        )
        .then(({ data: res }) => {
          console.log('res--->', res);
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          } else {
            this.tableData = res.data.list;
            this.total = res.data.total;
            if (this.tableData.length <= 0 && this.currentPage > 1) {
              this.currentPage -= 1;
              this.getMemberList();
            }
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
    jjcancleHandle() {
      this.jjdialogShow = false;
      this.jjForm = {
        deptId: null,
        name: '',
        rejectReason: '',
      };
    },
    jjsubmitHandle() {
      this.$refs.jjForm.validate((valid) => {
        if (valid) {
          this.$http
            .post('/sys/organized/exitOrganized', this.jjForm)
            .then(({ data: res }) => {
              if (res.code !== 0) {
                return this.$message.error(res.msg);
              } else {
                this.$message.success(this.$t('add.add26'));
                this.getMemberList();
                this.jjdialogShow = false;
                this.jjForm = {
                  deptId: null,
                  name: '',
                  rejectReason: '',
                };
                this.getMemberList();
              }
            })
            .catch((err) => {
              console.log('err', err);
            });
        } else {
          return false;
        }
      });
    },
    beforeHandleCommand(id, command, realName) {
      return {
        id: id,
        command: command,
        realName: realName,
      };
    },
    // 审核 同意
    approveMember(command) {
      if (command.command == 'ty' || command.command == 'jj') {
        let title = '';
        const form = {
          id: command.id,
          checkStatus: '', // 0,待审核,1: 审核通过 ,2,审核拒绝
        };
        if (command.command == 'ty') {
          form.checkStatus = 1;
          title = this.$t('members.chengyuan68');
          this.$confirm(
            this.$t('members.chengyuan35') +
              `${title}` +
              this.$t('members.chengyuan36') +
              `【${command.realName}】` +
              this.$t('members.chengyuan37'),
            this.$t('members.chengyuan38'),
            {
              confirmButtonText: this.$t('members.chengyuan39'),
              cancelButtonText: this.$t('members.chengyuan40'),
              type: 'warning',
            },
          )
            .then(async () => {
              this.$http
                .post('/sys/organized/approveMember', form)
                .then(({ data: res }) => {
                  if (res.code !== 0) {
                    return this.$message.error(res.msg);
                  } else {
                    if (command.command == 'ty') {
                      this.$message.success(this.$t('members.chengyuan41'));
                    } else if (command.command == 'jj') {
                      this.$message.success(this.$t('members.chengyuan42'));
                    }
                    this.getMemberList();
                  }
                })
                .catch((err) => {
                  console.log('err', err);
                });
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: this.$t('members.chengyuan43'),
              });
            });
        } else if (command.command == 'jj') {
          // form.checkStatus = 2
          // title = '拒绝'
          this.jjForm.deptId = command.id;
          this.jjForm.name = command.realName;
          this.jjdialogShow = true;
        }
      } else if (command.command == 'pt' || command.command == 'gly') {
        const form = {
          id: command.id,
          roleId: '',
        };
        let title = '';
        const organizedType = localStorage.getItem('user_organizedType'); // 1诊所  2技工所
        if (command.command == 'pt') {
          if (organizedType == 1) {
            form.roleId = 3;
          } else if (organizedType == 2) {
            form.roleId = 5;
          }
          title = this.$t('members.chengyuan44');
        } else if (command.command == 'gly') {
          if (organizedType == 1) {
            form.roleId = 2;
          } else if (organizedType == 2) {
            form.roleId = 4;
          }
          title = this.$t('members.chengyuan45');
        }
        this.$confirm(
          this.$t('members.chengyuan47') +
            `【${command.realName}】` +
            this.$t('members.chengyuan48') +
            `“${title}”` +
            this.$t('members.chengyuan49'),
          this.$t('members.chengyuan38'),
          {
            confirmButtonText: this.$t('members.chengyuan39'),
            cancelButtonText: this.$t('members.chengyuan40'),
            type: 'warning',
          },
        )
          .then(async () => {
            this.$http
              .post('/sys/organized/updateMemberRole', form)
              .then(({ data: res }) => {
                if (res.code !== 0) {
                  return this.$message.error(res.msg);
                } else {
                  this.$message.success(this.$t('members.chengyuan50'));
                  this.getMemberList();
                }
              })
              .catch((err) => {
                console.log('err', err);
              });
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: this.$t('members.chengyuan43'),
            });
          });
      }
    },
    delcancleHandle() {
      this.deleteForm = {
        id: '',
        realName: '',
        remark: '',
      };
      this.dialogShow = false;
      this.$message({
        type: 'info',
        message: this.$t('members.chengyuan43'),
      });
    },
    delsubmitHandle() {
      // if (this.deleteForm.remark == '') {
      //     return this.$message.error('请输入删除原因')
      // }
      this.$http
        .post('/sys/organized/delMember', this.deleteForm)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          } else {
            this.$message.success(this.$t('members.chengyuan46'));
            this.getMemberList();
            this.dialogShow = false;
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
    deleteItem(id, realName, checkStatus) {
      this.deleteForm.id = id;
      this.deleteForm.realName = realName;
      // 已确认
      if (checkStatus == 1) {
        this.dialogShow = true;
      } else if (checkStatus == 0) {
        // 待确认
        this.$confirm(
          this.$t('members.chengyuan51') + `【${realName}】` + this.$t('members.chengyuan52'),
          this.$t('members.chengyuan38'),
          {
            confirmButtonText: this.$t('members.chengyuan39'),
            cancelButtonText: this.$t('members.chengyuan40'),
            type: 'warning',
          },
        )
          .then(async () => {
            this.$http
              .post('/sys/organized/delMember', this.deleteForm)
              .then(({ data: res }) => {
                if (res.code !== 0) {
                  return this.$message.error(res.msg);
                } else {
                  this.$message.success(this.$t('members.chengyuan46'));
                  this.getMemberList();
                }
              })
              .catch((err) => {
                console.log('err', err);
              });
          })
          .catch(() => {
            this.$message({
              type: 'info',
              message: this.$t('members.chengyuan43'),
            });
          });
      }
    },
    // 退出原因
    tuichu(val) {
      this.$alert(val, this.$t('members.chengyuan23'), {
        confirmButtonText: this.$t('members.chengyuan31'),
      });
    },
    // 拒绝原因
    jujue(val) {
      this.$alert(val, this.$t('members.chengyuan27'), {
        confirmButtonText: this.$t('members.chengyuan31'),
      });
    },
    memberAdd() {
      this.$refs.MemberAdd.dialogShow = true;
    },
    handleSizeChange(val) {
      this.limit = val;
      this.getMemberList();
    },
    handleCurrentChange(val) {
      this.currentPage = val;
      this.getMemberList();
    },

    /***
     * 权限改造部分
     */
    surePowerRow(row, isShowRole) {
      this.powerRow = JSON.parse(JSON.stringify(row));
      this.getPowerData(this.powerRow.roleId, true, isShowRole);
    },
    /**
     * 请求权限组件中的权限列表数据
     * bool是判断是否是自己组件调用的
     */

    getPowerData(roleId, bool, isShowRole) {
      // 保存切换的roleId
      this.changeRoleId = roleId;
      console.log('21232', roleId, this.powerRow.roleId);
      this.$http
        .get(`/sys/menu/select?roleId=${roleId}&type=${this.user_type}`)
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          } else {
            this.permissionList = res.data;
            let currRef = this.$refs[`power${this.powerRow.id}`];
            currRef.checkPermissions = [];
            currRef.permissionList = this.permissionList;
            this.permissionList.forEach((item1) => {
              this.powerRow.userMenuList.forEach((item2) => {
                if (item1.id === item2 && item1.disable !== '禁用') {
                  currRef.checkPermissions.push(item2);
                }
              });
            });
            if (bool) {
              currRef.role = Number(this.powerRow.roleId);
            }

            if (isShowRole === '1') {
              currRef.isShowRole = true;
            } else if (isShowRole === '2') {
              currRef.isShowRole = false;
            }
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
    transferOwner(row) {
      this.transferOwnerShow = true;
      this.$nextTick(() => {
        let sendCodeEl = this.$refs.sendCodeEl;

        sendCodeEl.verificationForm.email_phone = '';
        sendCodeEl.verificationForm.code = '';
        sendCodeEl.clickCount = 0;
        this.currStep = 1;
        sendCodeEl.count_down = 60;
        sendCodeEl.isClickCode = false;
        clearInterval(sendCodeEl.downTime);
        sendCodeEl.downTime = null;
        this.transferor = '';
        this.transferorList = [];

        this.transferRow = row;

        if (this.caminho === 'mobile') {
          sendCodeEl.verificationForm.email_phone = this.transferRow.mobile;
        } else if (this.caminho === 'email') {
          sendCodeEl.verificationForm.email_phone = this.transferRow.email;
        }
      });
    },
    transfercancleHandle() {
      this.transferOwnerShow = false;
    },
    async transfersubmitHandle(type) {
      let sendCodeEl = this.$refs.sendCodeEl;
      let email_phone = sendCodeEl.verificationForm.email_phone;
      let code = sendCodeEl.verificationForm.code;
      if (type === 'next') {
        if (!sendCodeEl.verificationForm.code) {
          return this.$message({
            message: this.$t('login.codetext'),
            type: 'warning',
          });
        }
        if (this.caminho === 'mobile') {
          let formData = new FormData();
          formData.append('phone', email_phone);
          formData.append('code', code);
          let res = await this.$http.post('/smsMessage/verify', formData);
          if (res.data.code !== 0) {
            return this.$message.error(res.data.msg);
          } else {
            this.currStep = 2;
          }
        } else if (this.caminho === 'email') {
          let res = await this.$http.get(
            `/open/sms/verifyCode?phoneOrEmail=${email_phone}&code=${code}`,
          );
          if (res.data.code !== 0) {
            return this.$message.error(res.data.msg);
          } else {
            this.currStep = 2;
          }
        }
        this.$http
          .get(
            `/sys/organized/getMemberList?page=${this.currentPage}&limit=1000&timeZone=${this.$timeZone}`,
          )
          .then(({ data: res }) => {
            if (res.code !== 0) {
              return this.$message.error(res.msg);
            } else {
              this.transferorList = res.data.list.filter(
                (f) => f.owner != 1 && f.checkStatus === '1',
              );
              this.transferorList.forEach((item) => {
                item['value'] = `${item.realName}(${item.email})`;
              });
            }
          })
          .catch((err) => {
            console.log('err', err);
          });
      } else if (type === 'submit') {
        if (!this.transferor) {
          return this.$message({
            message: this.$t('members.chengyuan74'),
            type: 'warning',
          });
        }
        this.$confirm(this.$t('members.chengyuan75'), this.$t('members.chengyuan70'), {
          confirmButtonText: this.$t('members.chengyuan31'),
          cancelButtonText: this.$t('members.chengyuan30'),
          type: 'warning',
        })
          .then(() => {
            // 选择了转让对象之后
            let targetObj = this.transferorList.filter((f) => f.id === this.transferor)[0];
            this.$http
              .post('/sys/organized/transferOwner', {
                owner: this.transferRow,
                target: targetObj,
              })
              .then(({ data: res }) => {
                if (res.code !== 0) {
                  return this.$message.error(res.msg);
                } else {
                  this.$message({
                    message: this.$t('members.chengyuan76'),
                    type: 'success',
                  });
                  this.logOut();
                }
              })
              .catch((err) => {
                console.log('err', err);
              });
          })
          .catch(() => {});
      }
      // this.transferOwnerShow = false;
    },
    // 退出登录
    logOut() {
      this.$http
        .post('/open/logout')
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          }
          window.localStorage.removeItem('user_headUrl');
          window.localStorage.removeItem('user_realName');
          window.localStorage.removeItem('user_superAdmin');
          window.localStorage.removeItem('user_organizedRoleId');
          window.localStorage.removeItem('user_organizedType');
          window.localStorage.removeItem('user_roleId');
          window.localStorage.removeItem('user_jg_id');
          window.localStorage.removeItem('user_owner');
          window.localStorage.removeItem('user_permissionsList');
          window.localStorage.removeItem('user_id');
          window.localStorage.removeItem('user_name');
          window.localStorage.removeItem('user_roleId');
          window.localStorage.removeItem('user_organizedType');
          window.localStorage.removeItem('user_adminRoleName');
          window.localStorage.removeItem('tg_expand');
          // window.localStorage.removeItem('lang');
          Cookies.set('token', '', -1);

          this.$router.push('/');
        })
        .catch((err) => {
          console.log('err', err);
        });
    },

    powerCance(id) {
      this.$refs[id].doClose();
    },
    powerSubmit(row) {
      let currRef = this.$refs[`power${row.id}`];
      let checkStatus;
      if (this.changeRoleId === row.roleId) {
        checkStatus = '1';
      } else {
        checkStatus = '0';
      }
      // 这里需要保存设置管理员和 设置权限接口
      this.$http
        .post('/sys/organized/updateMemberRole', {
          id: row.id,
          roleId: currRef.role,
          checkStatus,
        })
        .then(({ data: res }) => {
          if (res.code !== 0) {
            return this.$message.error(res.msg);
          } else {
            this.$http
              .put('/sys/role', {
                userId: row.userId,
                menuIdList: currRef.checkPermissions,
              })
              .then(({ data: res1 }) => {
                if (res1.code !== 0) {
                  return this.$message.error(res1.msg);
                } else {
                  this.powerCance(row.id);
                  this.getMemberList();
                  this.$message.success(this.$t('institutionSetting.jigou76'));
                }
              })
              .catch((err1) => {
                console.log('err', err1);
              });
          }
        })
        .catch((err) => {
          console.log('err', err);
        });
    },
  },
};
</script>

<style lang="scss">
.top_nav {
  // height: 77px;
  // box-sizing: border-box;

  .top_nav_inner {
    padding-top: 5px;
    display: flex;
    justify-content: space-between;
    // .top_nav_left{

    // }
    // .top_nav_right{

    // }
  }
}

.partner_inner {
  margin-top: 20px;
  .el-button--text {
    margin: 0 5px 0 5px;
  }
  .cell {
    display: flex;
    justify-content: center;
  }
}
.organizationmember {
  .el-popper {
    padding: 0px;
  }
}
.transfer_box {
  width: 80% !important;
  margin: auto !important;
  .transferStep_box {
    .transferStep {
      margin: auto !important;
      width: 49% !important;
      margin-bottom: 20px !important;
    }
  }
  .transfer_content_box {
    // .sendCode {
    //   position: absolute;
    //   right: 20px;
    //   border-left: 1px solid #e4e7ed;
    //   padding-left: 10px;
    //   height: 30px;
    //   top: 50%;
    //   line-height: 30px;
    //   transform: translate(0, -50%);
    //   cursor: pointer;
    //   color: #003e67;
    // }
  }
}
.transferorSelect {
  .el-select-dropdown__item {
    height: auto;
  }
}
</style>
